#ifndef TESTMANAGER_H
#define TESTMANAGER_H

#include <QDebug>
#include <QObject>
#include <QFile>
#include <QDataStream>
#include <QTime>
#include "testbd.h"
#include "test.h"

class TestManager : public QObject
{
public:
    TestManager();

    void readTestsDbFromFile();
    void writeTestsDbToFile();
    void setTestFileDir(const QString &fileDirPath);

    void addTestFromText(const QString &testTextFile, quint32 testNumVis);
    bool delTestByName(const QString &testName);

    QStringList getTestList() const;
    Test getTestByName(const QString &testName);
    Test getRunTestByName(const QString &testName);


private:
    TestBD tests;
    QString dbFileName;
    QString testFileDir;
    quint32 magicNumber;

    QString getTestFileNameByName(const QString &name) const;
    void readNodeFromText(Test &test, const QString &text);
};

#endif // TESTMANAGER_H
